{% extends "base.html" %}
{# Copyright The IETF Trust 2015-2020, All Rights Reserved #}
{% load origin %}
{% load static %}
{% load ietf_filters person_filters %}
{% block title %}Possible Meeting Agendas for IETF {{ meeting.number }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>
        Possible Meeting Agendas
        <br>
        <small class="text-body-secondary">IETF {{ meeting.number }}</small>
    </h1>
    {% if can_edit_timeslots %}
        <a class="btn btn-primary my-3"
           href="{% url "ietf.meeting.views.edit_timeslots" num=meeting.number %}">
            Edit timeslots and room availability
        </a>
    {% endif %}
    {% for schedules, own, label in schedule_groups %}
        <h2 class="mt-4">{{ label }}</h2>
        {% if own %}
            <a class="btn btn-primary mb-3"
               href="{% url "ietf.meeting.views.new_meeting_schedule" num=meeting.number %}">
                <i class="bi bi-plus"></i> New Agenda
            </a>
        {% endif %}
        <table class="table table-sm table-striped tablesorter">
            <thead>
                <tr>
                    <th scope="col" data-sort="name">Name</th>
                    <th scope="col" data-sort="owner">Owner</th>
                    <th scope="col" data-sort="origin">Origin</th>
                    <th scope="col" data-sort="base">Base</th>
                    <th scope="col" data-sort="notes">Notes</th>
                    <th scope="col" data-sort="visible">Visible</th>
                    <th scope="col" data-sort="public">Public</th>
                    <td></td>
                </tr>
            </thead>
            {% if schedules %}
                <tbody>
                    {% for schedule in schedules %}
                        <tr>
                            <td>
                                <a href="{% url "ietf.meeting.views.edit_meeting_schedule" meeting.number schedule.owner_email schedule.name %}"
                                   title="Show regular sessions in agenda">
                                    {{ schedule.name }}
                                </a>
                            </td>
                            <td>{% person_link schedule.owner %}</td>
                            <td>
                                {% if schedule.origin %}
                                    <a href="{% url "ietf.meeting.views.edit_meeting_schedule" meeting.number schedule.origin.owner_email schedule.origin.name %}">
                                        {{ schedule.origin.name }}
                                    </a>
                                    <a href="{% url "ietf.meeting.views.diff_schedules" meeting.number %}?from_schedule={{ schedule.origin.name|urlencode }}&to_schedule={{ schedule.name|urlencode }}"
                                       title="{{ schedule.changes_from_origin }} change{{ schedule.changes_from_origin|pluralize }} from {{ schedule.origin.name }}">
                                        +{{ schedule.changes_from_origin }}
                                    </a>
                                {% endif %}
                            </td>
                            <td>
                                {% if schedule.base %}
                                    <a href="{% url "ietf.meeting.views.edit_meeting_timeslots_and_misc_sessions" meeting.number schedule.base.owner_email schedule.base.name %}">
                                        {{ schedule.base.name }}
                                    </a>
                                {% endif %}
                            </td>
                            <td>{{ schedule.notes|linebreaksbr }}</td>
                            <td>
                                {% if schedule.visible %}
                                    <div class="badge rounded-pill text-bg-success">Visible</div>
                                {% else %}
                                    <div class="badge rounded-pill text-bg-warning">Hidden</div>
                                {% endif %}
                            </td>
                            <td>
                                {% if schedule.public %}
                                    <div class="badge rounded-pill text-bg-success">Public</div>
                                {% else %}
                                    <div class="badge rounded-pill text-bg-warning">Private</div>
                                {% endif %}
                            </td>
                            <td>
                                <div class="btn-group btn-group-sm float-end" role="group">
                                    {% if schedule.can_edit_properties %}
                                        <a class="btn btn-outline-primary edit-schedule-properties"
                                           title="Edit agenda properties"
                                           aria-label="Edit agenda properties"
                                           href="{% url "ietf.meeting.views.edit_schedule_properties" meeting.number schedule.owner_email schedule.name %}?next={{ request.get_full_path|urlencode }}">
                                            <i class="bi bi-pencil"></i>
                                        </a>
                                    {% endif %}
                                    <a class="btn btn-outline-primary"
                                       title="Show timeslots and misc. sessions for agenda"
                                       aria-label="Show timeslots and misc. sessions for agenda"
                                       href="{% url "ietf.meeting.views.edit_meeting_timeslots_and_misc_sessions" meeting.number schedule.owner_email schedule.name %}">
                                        <i class="bi bi-calendar"></i>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            {% endif %}
        </table>
    {% endfor %}
{% endblock %}